from rest_framework import serializers
from .models import Cate,Group

class CateSer(serializers.ModelSerializer):
    class Meta:
        model = Cate
        fields = '__all__'

class GroupSer(serializers.ModelSerializer):
    cate_name = serializers.SerializerMethodField(read_only=True)
    def get_cate_name(self,obj):
        return obj.cate.name
    class Meta:
        model = Group
        fields = '__all__'

